gtk4.git
6 years agoUpdate Croatian translation
Goran Vidović [Sun, 19 Jan 2020 00:33:57 +0000 (00:33 +0000)]
Update Croatian translation

6 years agoUpdate Croatian translation
Goran Vidović [Sun, 19 Jan 2020 00:13:42 +0000 (00:13 +0000)]
Update Croatian translation

6 years agoRefine the selector tree printing
Matthias Clasen [Sat, 18 Jan 2020 19:18:47 +0000 (14:18 -0500)]
Refine the selector tree printing

Also show which tree nodes have exact matches.

6 years agoFix a css change testcase
Matthias Clasen [Sat, 18 Jan 2020 19:16:36 +0000 (14:16 -0500)]
Fix a css change testcase

The ui file here was invalid, leading to nonsensical
results.

6 years agoActually turn of css value accounting
Matthias Clasen [Sat, 18 Jan 2020 17:10:26 +0000 (12:10 -0500)]
Actually turn of css value accounting

We need an #undef here. While doing so, make sure
it compiles without warnings when disabled.

6 years agoinspector: Avoid an array overrun
Matthias Clasen [Sat, 18 Jan 2020 15:51:54 +0000 (10:51 -0500)]
inspector: Avoid an array overrun

Commit 3f56af373891bf6e3 added a new value to the
GdkInputSource enum, forgetting that the inspector
has an array of names to match this enum.

Fixes: https://gitlab.gnome.org/GNOME/gtk/issues/2385
6 years agowayland: Fix release build warnings
Matthias Clasen [Sat, 18 Jan 2020 07:34:56 +0000 (02:34 -0500)]
wayland: Fix release build warnings

6 years agox11: Fix release build warnings
Matthias Clasen [Sat, 18 Jan 2020 07:34:25 +0000 (02:34 -0500)]
x11: Fix release build warnings

6 years agoUpdate POTFILES.skip
Piotr Drąg [Sat, 18 Jan 2020 16:39:53 +0000 (17:39 +0100)]
Update POTFILES.skip

6 years agogl renderer: Pull a local variable in the closest scope
Timm Bäder [Fri, 17 Jan 2020 15:37:29 +0000 (16:37 +0100)]
gl renderer: Pull a local variable in the closest scope

6 years agocssimagefallback: Don't snapshot invisible colors
Timm Bäder [Thu, 16 Jan 2020 12:41:55 +0000 (13:41 +0100)]
cssimagefallback: Don't snapshot invisible colors

This avoids a few render nodes later.

6 years agowidget: Get opacity without GtkStyleContext
Timm Bäder [Thu, 16 Jan 2020 12:17:35 +0000 (13:17 +0100)]
widget: Get opacity without GtkStyleContext

GtkStyleContext is really just unnecessary here.

6 years agocssstyle: set font variations in get_pango_font()
Timm Bäder [Thu, 16 Jan 2020 10:33:12 +0000 (11:33 +0100)]
cssstyle: set font variations in get_pango_font()

Doesn't make sense to set all the css values on the font description in
there except for the font variations, so do these here as well.

6 years agowidget: Get DPI from style directly
Timm Bäder [Thu, 16 Jan 2020 10:30:14 +0000 (11:30 +0100)]
widget: Get DPI from style directly

Instead of going through GtkStyleContext.

6 years agocssstyle: Implement get_pango_font() directly
Timm Bäder [Thu, 16 Jan 2020 10:27:37 +0000 (11:27 +0100)]
cssstyle: Implement get_pango_font() directly

Instead of going through the slow GValue code path. This function was
unused, so use it in GtkWidget's update_pango_context() now.

6 years agotestsuite: Update expected css errors
Timm Bäder [Thu, 16 Jan 2020 08:56:46 +0000 (09:56 +0100)]
testsuite: Update expected css errors

6 years agogl renderer: Draw outset shadows white
Timm Bäder [Thu, 16 Jan 2020 07:02:48 +0000 (08:02 +0100)]
gl renderer: Draw outset shadows white

and only apply the actual shadow color when we draw them from the
texture. This way we can reuse the cached shadows during color
transitions.

6 years agocss: Mark transform value as computed
Matthias Clasen [Sun, 12 Jan 2020 01:09:56 +0000 (20:09 -0500)]
css: Mark transform value as computed

This is not very useful, since transitions generate
a ton of transforms anyway.

6 years agocss: Simplify default values
Matthias Clasen [Sun, 12 Jan 2020 00:05:39 +0000 (19:05 -0500)]
css: Simplify default values

We no longer need to create one-element arrays or
corners with two identical values.

6 years agocss: Re-add a lost special case
Matthias Clasen [Mon, 13 Jan 2020 12:34:08 +0000 (07:34 -0500)]
css: Re-add a lost special case

When the border-style special cases were moved in
c687f485fdd0a, the one for outline-width was lost.

Make the code more compact, and bring the special
case back.

6 years agocsshorthandproperty: Try to avoid allocating a GString for 1 font
Timm Bäder [Wed, 15 Jan 2020 12:18:16 +0000 (13:18 +0100)]
csshorthandproperty: Try to avoid allocating a GString for 1 font

6 years agocssdimensionvalue: remove early-out code from transition()
Timm Bäder [Wed, 15 Jan 2020 08:57:11 +0000 (09:57 +0100)]
cssdimensionvalue: remove early-out code from transition()

We do this directly in gtk_css_value_transition() now

6 years agogl renderer: Render simple border nodes in a simple way
Timm Bäder [Tue, 14 Jan 2020 14:43:53 +0000 (15:43 +0100)]
gl renderer: Render simple border nodes in a simple way

Roughly 80% of the border nodes are just one color and have the same
width on all sides, so we can draw them by uploading just one rect and
not four.

6 years agonumbervalue: Add early-out to multiply()
Timm Bäder [Tue, 14 Jan 2020 14:39:48 +0000 (15:39 +0100)]
numbervalue: Add early-out to multiply()

If the factor is 1, we already know what the result is going to be.

6 years agocssnumbervalue: Move early-out code to GtkCssValue
Timm Bäder [Tue, 14 Jan 2020 14:37:30 +0000 (15:37 +0100)]
cssnumbervalue: Move early-out code to GtkCssValue

These checks make sense for all css values.

6 years agocssdimensionvalue: Implement transition()
Timm Bäder [Tue, 14 Jan 2020 14:35:38 +0000 (15:35 +0100)]
cssdimensionvalue: Implement transition()

Instead of falling back to the generic gtk_css_number_value_transition
(which can allocate multiple new css values), just implement this here.

6 years agoRemove GtkCssShadowsValue
Timm Bäder [Tue, 14 Jan 2020 13:34:15 +0000 (14:34 +0100)]
Remove GtkCssShadowsValue

Previously, we wrapped all GtkCssShadowValues in a GtkCssShadowsValue,
even if it was just one shadow. This causes an unnecessary bloat in
css values.

Make each GtkCssShadowValue able to handle multiple shadows instead, and
use gtk_css_shadow_value* API everywhere.

6 years agocssshadowvalue: Only create 2 shadows values for transitions
Timm Bäder [Mon, 13 Jan 2020 07:37:52 +0000 (08:37 +0100)]
cssshadowvalue: Only create 2 shadows values for transitions

This is for cases where we want to transition from "no shadow" to
"shadow", which we need quite a lot.

6 years agocssvalue: Improve css value accounting output
Timm Bäder [Mon, 13 Jan 2020 09:19:56 +0000 (10:19 +0100)]
cssvalue: Improve css value accounting output

And make it fully optional behind an #ifdef.

6 years agocsscolorvalue: check for singletons in new_literal
Timm Bäder [Sun, 12 Jan 2020 14:53:26 +0000 (15:53 +0100)]
csscolorvalue: check for singletons in new_literal

Gets rid of another ~400 GtkCssValue instances in the widget-factory.

6 years agocssimage: Add is_computed vfunc
Timm Bäder [Sat, 11 Jan 2020 13:38:49 +0000 (14:38 +0100)]
cssimage: Add is_computed vfunc

Same semantics as the is_computed field of GtkCssValue

6 years agocss: Set the is_computed flag for more values
Timm Bäder [Sat, 11 Jan 2020 12:40:13 +0000 (13:40 +0100)]
css: Set the is_computed flag for more values

With these changes, we skip roughly 85% of compute() calls during
widget-factory startup

6 years agocssvalue: Don't call compute() for already computed css values
Timm Bäder [Sat, 11 Jan 2020 11:56:40 +0000 (12:56 +0100)]
cssvalue: Don't call compute() for already computed css values

As per the previous commit, this is unnecessary.

Even with the small amount of css values we mark as is_computed, we
already skip computing over 60% of them like this during the startup of
the widget factory.

6 years agocssvalue: Add is_computed flag
Timm Bäder [Sat, 11 Jan 2020 11:53:23 +0000 (12:53 +0100)]
cssvalue: Add is_computed flag

When a css value has "child" css values (e.g. a linear gradient has
several color stop css values) which are all computed (won't change when
compute() is called on them), we want to skip computing the entire
subtree.

Since css values are immutable, we can set the is_computed flag at
construct time.

Since GtkCssValue instances are 0-initialized in _gtk_css_value_alloc,
the default for is_computed it FALSE. This commit only sets it to TRUE
in a few cases, such as various "none" singleton values which will never
change. Later commits will refine this and set it for more values.

6 years agotestsuite: Update css color output
Timm Bäder [Sat, 11 Jan 2020 11:29:05 +0000 (12:29 +0100)]
testsuite: Update css color output

6 years agocss: Move border-width special cases out of GtkCssDimensionValue
Timm Bäder [Sat, 11 Jan 2020 11:22:19 +0000 (12:22 +0100)]
css: Move border-width special cases out of GtkCssDimensionValue

Move them to style computation instead, so we don't have them in such a
generic place.

6 years agocsscolorvalue: Don't copy rgbas when applying function
Timm Bäder [Sat, 11 Jan 2020 10:54:39 +0000 (11:54 +0100)]
csscolorvalue: Don't copy rgbas when applying function

We get const pointers to the colors, so just use those and unref the
values later.

6 years agogl renderer: Look at shadow color in the outset shadow cache
Timm Bäder [Sat, 11 Jan 2020 10:26:27 +0000 (11:26 +0100)]
gl renderer: Look at shadow color in the outset shadow cache

It would probably be better to not do this and always render the outline
in plain white, then later recolor it but do this for no, just for
correctness.

6 years agocssimageradial: Use array + length instead of GArray
Timm Bäder [Sat, 11 Jan 2020 09:00:25 +0000 (10:00 +0100)]
cssimageradial: Use array + length instead of GArray

This makes sense since we're not going to change the (amount of) colors
after parsing.

6 years agocssimagelinear: Use count+array for the color stops, not GArray
Timm Bäder [Sat, 11 Jan 2020 08:05:07 +0000 (09:05 +0100)]
cssimagelinear: Use count+array for the color stops, not GArray

This makse sense but will also make later changes to GtkCssImageLinear
simpler.

6 years agocssimagefallback: Don't compute new image if only a color is set
Timm Bäder [Sat, 11 Jan 2020 07:25:52 +0000 (08:25 +0100)]
cssimagefallback: Don't compute new image if only a color is set

Themes might use e.g. image(red), which is a constant value and will
never change. In that case, the fallback image has ->color set, but not
->images. If that's the case and the computed color is the same as
the one we already have, just return the already existing image.

6 years agoRemove GtkCssRgbaValue
Timm Bäder [Fri, 10 Jan 2020 12:02:33 +0000 (13:02 +0100)]
Remove GtkCssRgbaValue

The differenciation between a literal color value and an RGBA value
caused problems in various situations. Just treat the two the same but
don't allow access to the rgba value of a non-literal color value.

This gets rid of around 1.6k rgba values in the widget-factory.

6 years agodump css value stats
Matthias Clasen [Fri, 10 Jan 2020 04:48:30 +0000 (23:48 -0500)]
dump css value stats

6 years agocsssshadwovalue: Remove unused function prototype
Timm Bäder [Thu, 9 Jan 2020 11:52:20 +0000 (12:52 +0100)]
csssshadwovalue: Remove unused function prototype

6 years agocssnumbervalue: Add early-outs to transition code
Timm Bäder [Wed, 8 Jan 2020 08:42:23 +0000 (09:42 +0100)]
cssnumbervalue: Add early-outs to transition code

we don't need to do the calculation at all if the progress is 0 or 1
anyway.

We also sometimes transition from 0 to 0 etc., so we can short-circuit
that as well by doing the fast pointer-equality check and relying on the
singletons.

6 years agocsscornervalue: Accept other values if x == y
Timm Bäder [Wed, 8 Jan 2020 08:11:02 +0000 (09:11 +0100)]
csscornervalue: Accept other values if x == y

Most corners are square, so x == y. In that case, just accept either of
them. This makes the corner value unnecessary.

In fact none of the corner values in the widget-factory are needed, so
this spares us around 500 corner value allocations.

css value stats before:

GtkCssBgSizeValue: 23
GtkCssIdentValue: 25
GtkCssPositionValue: 81
GtkCssCornerValue: 556
GtkCssArrayValue: 143
GtkCssStringValue: 33
GtkCssPaletteValue: 29
GtkCssImageValue: 2765
GtkCssColorValue: 1452
GtkCssFilterValue: 3
GtkCssRgbaValue: 1092
GtkCssShadowValue: 708
GtkCssEaseValue: 33
GtkCssBorderValue: 2
GtkCssTransformValue: 11
GtkCssDimensionValue: 882
GtkCssShadowsValue: 584
SUM: 8428

and after:

GtkCssColorValue: 1452
GtkCssFilterValue: 3
GtkCssRgbaValue: 1092
GtkCssShadowValue: 708
GtkCssEaseValue: 33
GtkCssBorderValue: 2
GtkCssTransformValue: 11
GtkCssDimensionValue: 882
GtkCssShadowsValue: 584
GtkCssBgSizeValue: 23
GtkCssIdentValue: 25
GtkCssPositionValue: 81
GtkCssArrayValue: 143
GtkCssStringValue: 33
GtkCssPaletteValue: 29
GtkCssImageValue: 2765
SUM: 7872

8428 to 7872 is a 556 reduction (6.5%)

asdf

6 years agocssarrayvalue: Don't allocate memory when parsing array values
Timm Bäder [Wed, 8 Jan 2020 07:58:07 +0000 (08:58 +0100)]
cssarrayvalue: Don't allocate memory when parsing array values

We probably won't find CSS with more than 128 values in array.

6 years agocssarrayvalue: Allow calling array API on non-arrays
Timm Bäder [Wed, 8 Jan 2020 07:37:04 +0000 (08:37 +0100)]
cssarrayvalue: Allow calling array API on non-arrays

Just allow calling _get_nth() and _get_n_values() on every kind of css
value. This way we can allow all values in places where only array
values would be allowed before.

This spares us around 1000 array values in the widget factory.

css value stats before:

GtkCssFilterValue: 3
GtkCssRgbaValue: 1092
GtkCssShadowValue: 708
GtkCssEaseValue: 33
GtkCssBorderValue: 2
GtkCssTransformValue: 11
GtkCssDimensionValue: 882
GtkCssShadowsValue: 584
GtkCssBgSizeValue: 23
GtkCssIdentValue: 25
GtkCssPositionValue: 81
GtkCssCornerValue: 556
GtkCssArrayValue: 1130
GtkCssStringValue: 33
GtkCssPaletteValue: 29
GtkCssImageValue: 2765
GtkCssColorValue: 1452
SUM: 9415

and after:

GtkCssBgSizeValue: 23
GtkCssIdentValue: 25
GtkCssPositionValue: 81
GtkCssCornerValue: 556
GtkCssArrayValue: 143
GtkCssStringValue: 33
GtkCssPaletteValue: 29
GtkCssImageValue: 2765
GtkCssColorValue: 1452
GtkCssFilterValue: 3
GtkCssRgbaValue: 1092
GtkCssShadowValue: 708
GtkCssEaseValue: 33
GtkCssBorderValue: 2
GtkCssTransformValue: 11
GtkCssDimensionValue: 882
GtkCssShadowsValue: 584
SUM: 8428

9415 to 8428 is a 987 reduction (10.4%)

6 years agocssvalue: Add type names for all classes
Timm Bäder [Thu, 9 Jan 2020 10:57:00 +0000 (11:57 +0100)]
cssvalue: Add type names for all classes

This is important to have for debugging and e.g. to print statistics for
the individual css value types

6 years agocsscolorvalue: Compute alpha/shade/mix of color literals directly
Timm Bäder [Thu, 9 Jan 2020 10:54:58 +0000 (11:54 +0100)]
csscolorvalue: Compute alpha/shade/mix of color literals directly

The values of these are never gonna change so we can as well create
literal color values from the resulting colors instead.

6 years agocsscolorvalue: Don't resolve literal color values
Timm Bäder [Thu, 9 Jan 2020 09:22:53 +0000 (10:22 +0100)]
csscolorvalue: Don't resolve literal color values

6 years agoMerge branch 'adwaita-performance' into 'master'
Matthias Clasen [Sat, 18 Jan 2020 06:43:11 +0000 (06:43 +0000)]
Merge branch 'adwaita-performance' into 'master'

Adwaita: Remove wildcards

Closes #2380

See merge request GNOME/gtk!1330

6 years agoAdwaita: Remove wildcards
Matthias Clasen [Sat, 18 Jan 2020 06:27:31 +0000 (01:27 -0500)]
Adwaita: Remove wildcards

Selectors like *:disabled or *:link have bad performance
implications, since they cause all styles to be recomputed
when the state of the window changes. Replace these by a
list of the elements that are actually affected.

Fixes: https://gitlab.gnome.org/GNOME/gtk/issues/2380
6 years agoMerge branch 'matthiasc/css-change-tracking-4' into 'master'
Matthias Clasen [Sat, 18 Jan 2020 05:41:26 +0000 (05:41 +0000)]
Merge branch 'matthiasc/css-change-tracking-4' into 'master'

Improve change computation

See merge request GNOME/gtk!1327

6 years agoRemove the widget-factory test again
Matthias Clasen [Sat, 18 Jan 2020 05:27:52 +0000 (00:27 -0500)]
Remove the widget-factory test again

This was failing in ci, in hard to track down ways.

6 years agochange tests: Update test output
Matthias Clasen [Fri, 17 Jan 2020 22:57:37 +0000 (17:57 -0500)]
change tests: Update test output

Some of these test cases involve :not, and thus are affected
by our now correct handling of it for change computation.

All of them are affected by the window now being visible.

6 years agoRemove no longer needed code
Matthias Clasen [Fri, 17 Jan 2020 16:12:13 +0000 (11:12 -0500)]
Remove no longer needed code

We no longer use superset or any matchers to find changes.

6 years agoGo back to the tree for computing change
Matthias Clasen [Fri, 17 Jan 2020 16:11:55 +0000 (11:11 -0500)]
Go back to the tree for computing change

6 years agoRedo the way we compute change
Matthias Clasen [Fri, 17 Jan 2020 16:10:14 +0000 (11:10 -0500)]
Redo the way we compute change

Instead of expecting a superset matcher, call
gtk_css_selector_match_for_change while walking the tree with the
original matcher. This fixes the handling of :not while determining
changes.

6 years agoBring back the reserved bit
Matthias Clasen [Fri, 17 Jan 2020 16:01:55 +0000 (11:01 -0500)]
Bring back the reserved bit

6 years agoRevert "Remove no longer used code"
Matthias Clasen [Fri, 17 Jan 2020 15:54:37 +0000 (10:54 -0500)]
Revert "Remove no longer used code"

This reverts commit 105acfe90866543904467b13fecdbed108cf43b2.

6 years agoAdd testcases for css change flags
Matthias Clasen [Fri, 17 Jan 2020 01:04:00 +0000 (20:04 -0500)]
Add testcases for css change flags

Add various tests for the change flag computation that
we do in the css selector tree.

test1: Just test the basic machinery of this test
test2: Trigger every change flag at least once
test3: Test that multiple states combine as expected
test4: Test negations (known to produce wrong results)
test5: Test a complex selector (not producing the expected
       output atm)
widget-factory.ui:
       The real thing: widget-factory+Adwaita. Note that
       this expedts to be run with GSETTINGS_BACKEND=memory

Note that test4 checks the wrong results that we currently
produce for selectors involving :not. It will have to be
updated when we fix the handling of :not. The widget-factory.ui
testcase will certainly also be affected.

6 years agoAdd a test for css change flags
Matthias Clasen [Fri, 17 Jan 2020 01:02:55 +0000 (20:02 -0500)]
Add a test for css change flags

6 years agoAdd a way to dump css node change values
Matthias Clasen [Tue, 14 Jan 2020 00:18:31 +0000 (19:18 -0500)]
Add a way to dump css node change values

Add a GTK_STYLE_CONTEXT_PRINT_SHOW_CHANGE flag that
tells gtk_style_context_to_string to include the
change values of nodes in the output. This will
help debugging css change tracking.

6 years agostyle tests: Update expected output
Matthias Clasen [Sat, 18 Jan 2020 01:58:05 +0000 (20:58 -0500)]
style tests: Update expected output

The printing of css nodes has changed, and the window
is visible now.

6 years agostyle tests: Show the window
Matthias Clasen [Wed, 15 Jan 2020 07:00:09 +0000 (02:00 -0500)]
style tests: Show the window

Not doing so somewhat defeats the point that we want
to verify the regular styles, not some weird initial
conditions.

6 years agostyle tests: Clean up --generate support
Matthias Clasen [Sat, 18 Jan 2020 01:57:51 +0000 (20:57 -0500)]
style tests: Clean up --generate support

Reshuffle things so we don't call gtk_test_init() when --generate
is passed, to avoid polluting the output with test spew.

6 years agonode tests: Update expected output
Matthias Clasen [Fri, 17 Jan 2020 22:07:46 +0000 (17:07 -0500)]
node tests: Update expected output

The printing of css nodes has changed and the
window is visible now.

6 years agonode tests: Show the window
Matthias Clasen [Sat, 18 Jan 2020 01:35:00 +0000 (20:35 -0500)]
node tests: Show the window

This avoids using default styles.

6 years agonode tests: Clean up --generate support
Matthias Clasen [Fri, 17 Jan 2020 22:02:43 +0000 (17:02 -0500)]
node tests: Clean up --generate support

Reshuffle things so we don't call gtk_test_init() when --generate
is passed, to avoid polluting the output with test spew.

6 years agoAdd an Empty theme for tests
Matthias Clasen [Fri, 17 Jan 2020 22:42:06 +0000 (17:42 -0500)]
Add an Empty theme for tests

6 years agocssnode: Fix a corner case in style computation
Matthias Clasen [Sat, 18 Jan 2020 03:00:21 +0000 (22:00 -0500)]
cssnode: Fix a corner case in style computation

When we recomputed the change flags, and the style
did not change, we still need to replace the style
object, since it holds the new change flags.

6 years agocssnodedeclaration: Make print output deterministic
Matthias Clasen [Fri, 17 Jan 2020 21:54:38 +0000 (16:54 -0500)]
cssnodedeclaration: Make print output deterministic

This was depending on the memory order of quarks, which
is not a good fit for tests that depend on this output.

6 years agoQuiet compiler warnings in release builds
Matthias Clasen [Fri, 17 Jan 2020 00:43:05 +0000 (19:43 -0500)]
Quiet compiler warnings in release builds

6 years agoTweak the file transfer portal _again_
Matthias Clasen [Sat, 18 Jan 2020 03:31:51 +0000 (22:31 -0500)]
Tweak the file transfer portal _again_

This is a neverending story. I was seeing problems in tests where
the nested mainloop was picking up unrelated timeouts.

Break down and make this async. This changes the ordering in which
the (de)serializers are registered. If this is causing issues, we
can introduce priorities or something else.

6 years agoMerge branch 'gtk-fix-gesture-get-center' into 'master'
Matthias Clasen [Fri, 17 Jan 2020 21:59:33 +0000 (21:59 +0000)]
Merge branch 'gtk-fix-gesture-get-center' into 'master'

gtkgesture: Fix gtk_gesture_get_bounding_box_center() for touchpads

Closes #2316

See merge request GNOME/gtk!1257

6 years agodemo: Use pinch translation in the gestures demo
Yariv Barkan [Sat, 14 Dec 2019 09:27:44 +0000 (11:27 +0200)]
demo: Use pinch translation in the gestures demo

Add the pinch translation offset to the pinch gesture demo. That allows
moving the square around in addition to the already-supported rotate and
zoom.

6 years agogtkgesture: Fix get-center for touchpad gestures
Yariv Barkan [Tue, 17 Dec 2019 11:28:17 +0000 (13:28 +0200)]
gtkgesture: Fix get-center for touchpad gestures

Touchpad gestures have only a single event sequence. The current
'center' of the gesture is the starting point + accumulated deltas.
Update gtk_gesture_get_bounding_box_center() accordingly.

6 years agoFix a few bugs in the css change flag definition
Matthias Clasen [Fri, 17 Jan 2020 02:13:09 +0000 (21:13 -0500)]
Fix a few bugs in the css change flag definition

These were found by the new change flag tests.

6 years agoMerge branch 'fix-imwayland-cursor' into 'master'
Timm Bäder [Fri, 17 Jan 2020 09:24:48 +0000 (09:24 +0000)]
Merge branch 'fix-imwayland-cursor' into 'master'

imwayland: Fix get_preedit_string cursor position (GTK4)

Closes #2383

See merge request GNOME/gtk!1328

6 years agoimwayland: Fix get_preedit_string cursor position
xdavidwu [Fri, 17 Jan 2020 08:01:01 +0000 (16:01 +0800)]
imwayland: Fix get_preedit_string cursor position

GtkIMContext get_preedit_string should return cursor position counted
in characters, but cursor_begin here is counted in bytes. This add the
missing conversion.

6 years agoMerge branch 'matthiasc/css-change-tracking-3' into 'master'
Matthias Clasen [Fri, 17 Jan 2020 00:38:04 +0000 (00:38 +0000)]
Merge branch 'matthiasc/css-change-tracking-3' into 'master'

Preliminary css matcher work

See merge request GNOME/gtk!1326

6 years agocssmatcher: Change get_state to has_state
Matthias Clasen [Fri, 17 Jan 2020 00:23:45 +0000 (19:23 -0500)]
cssmatcher: Change get_state to has_state

This matches all the other vfuncs, and it gets us
out of keeping several big state flag enumerations
in sync.

Update all callers.

6 years agoAllow printing css matchers
Matthias Clasen [Wed, 15 Jan 2020 07:03:08 +0000 (02:03 -0500)]
Allow printing css matchers

This can help in debugging css matching.

6 years agocss: Add a matcher type enum
Matthias Clasen [Wed, 15 Jan 2020 03:29:56 +0000 (22:29 -0500)]
css: Add a matcher type enum

For now, this just replaces the is_any boolean
by a type field in the class. It will be used in
future commits.

6 years agocss: Simplify the superset matcher
Matthias Clasen [Thu, 16 Jan 2020 22:50:32 +0000 (17:50 -0500)]
css: Simplify the superset matcher

We use the superset matcher in exactly one place,
so there is no need for the generality of allowing
to ignore different aspects. Just hardcode the one
case we need: ignoring everything except for name,
id and class.

6 years agoCosmetic change
Matthias Clasen [Thu, 16 Jan 2020 22:47:41 +0000 (17:47 -0500)]
Cosmetic change

Update comments for name changes that happened long ago.

6 years agocss: Fix the ANY matcher state list
Matthias Clasen [Wed, 15 Jan 2020 22:34:03 +0000 (17:34 -0500)]
css: Fix the ANY matcher state list

The ANY and matcher was not, in fact, matching any state,
since the list of states was not up-to-date.

The same fix applies to the superset matcher as well.

6 years agoMerge branch 'matthiasc/css-change-tracking-2' into 'master'
Matthias Clasen [Thu, 16 Jan 2020 23:00:17 +0000 (23:00 +0000)]
Merge branch 'matthiasc/css-change-tracking-2' into 'master'

Better css change tracking

See merge request GNOME/gtk!1325

6 years agoRemove an unused define
Matthias Clasen [Thu, 16 Jan 2020 22:39:03 +0000 (17:39 -0500)]
Remove an unused define

We no longer use the GTK_CSS_CHANGE_RESERVED_BIT define.

6 years agoRemove no longer used code
Matthias Clasen [Wed, 15 Jan 2020 22:12:51 +0000 (17:12 -0500)]
Remove no longer used code

We no longer consult the selector tree to find changes,
so this code is no longer needed.

6 years agocss: Don't got to the selector tree for change
Matthias Clasen [Wed, 15 Jan 2020 13:03:09 +0000 (08:03 -0500)]
css: Don't got to the selector tree for change

The tree is optimized for mimizing the decisions, and is built ahead-of-time.
That prevents us from taking advantage of the information in the matcher when
collecting changes.

So, instead do what we used to do for verification: Use the selector tree
for finding the superset matches, then just walk the rulesets to collect
the changes.

Since we are now recomputing the change masks much less frequently, this
slightly less optimized way of computing them is not a problem, and will
let us compute better results in the future, by improving the superset
matcher to be more precise.

6 years agocssprovider: Keep selectors around
Matthias Clasen [Thu, 16 Jan 2020 18:20:47 +0000 (13:20 -0500)]
cssprovider: Keep selectors around

Don't remove selectors from the rulsets after
creating the selector tree. We want to use them
in future commits.

6 years agoMerge branch 'matthiasc/css-change-tracking' into 'master'
Benjamin Otte [Thu, 16 Jan 2020 22:13:57 +0000 (22:13 +0000)]
Merge branch 'matthiasc/css-change-tracking' into 'master'

Better css change handling

See merge request GNOME/gtk!1324

6 years agocss: Avoid computing change too often
Matthias Clasen [Wed, 15 Jan 2020 07:35:21 +0000 (02:35 -0500)]
css: Avoid computing change too often

Most of the time when styles need to be recreated, the name and classes
of the css node haven't changed. In this case, the change value will not
change either, since we are computing change under the assumption that
name and classes are unchanged.

So don't recompute the change. This avoids the second match we do to
find the superset, cutting down the number of times we consult the
selector tree.

6 years agoRevisit gtk_css_style_get_static_style one more time
Matthias Clasen [Thu, 16 Jan 2020 21:59:21 +0000 (16:59 -0500)]
Revisit gtk_css_style_get_static_style one more time

Move the implementation to where it belongs.

6 years agoChange the signature of gtk_css_style_get_static_style
Matthias Clasen [Thu, 16 Jan 2020 18:56:07 +0000 (13:56 -0500)]
Change the signature of gtk_css_style_get_static_style

It is clearer if this function returns a GtkCssStaticStyle.

6 years agoQuiet a compiler warning
Matthias Clasen [Thu, 16 Jan 2020 17:17:49 +0000 (12:17 -0500)]
Quiet a compiler warning

This was causing warnings in a release build.

6 years agoMerge branch 'static-style-getter' into 'master'
Matthias Clasen [Thu, 16 Jan 2020 17:10:31 +0000 (17:10 +0000)]
Merge branch 'static-style-getter' into 'master'

css: Add gtk_css_style_get_static_style

See merge request GNOME/gtk!1323

6 years agocss: Add gtk_css_style_get_static_style
Matthias Clasen [Mon, 13 Jan 2020 03:44:58 +0000 (22:44 -0500)]
css: Add gtk_css_style_get_static_style

This lets us avoid poking directly at the GtkCssAnimatedStyle
struct in gtkcssnode.c.